local _class = {}
--- 入口
--- @public
TAG = "FromLua"
WATCH = "com.ld.sdk.LoginActivity"; --可以添加多个

function _class:setup(t)
    app = App();
    local a = app:getPackageName('梦幻西游');
    app:launchApp(a);
    app:sleep(2000);
    --添加过滤器 return true 后将会在watch里接收
    app:matchWindow(function(event)
        if event:getClassName() == WATCH then
            return true;
        else
            return false;
        end
    end)

    app:watch(function(event)
        Log:i(TAG, "event:" .. event:getClassName());
        if event:getClassName() == WATCH then
            WATCH = "";
            app:sleep(8000);
            findImage();
        end

    end)
end
function findImage()

    local res= Screen:capture();
    local point = Image:findImage(res, "/res/登录游戏.png")
    if point~=nil then
        app:toast("找到了")
        gesture =Gesture();
        gesture:clicked(point:x(),point:y(),0); --不需要多手势ID就为0
    end
end
return _class
